package com.avic.rong.activity.mine;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebSettings;

import com.avic.rong.BaseActivity;
import com.avic.rong.R;
import com.avic.rong.questionOrAnswer.StringUtil;
import com.example.minato.minastore.utils.AppUtils;

import butterknife.BindView;
import wendu.dsbridge.DWebView;

public class GrabageCollectActivity extends BaseActivity {


    private String title;
    private String subTitle;

    @BindView(R.id.dwebview)
    DWebView dWebView;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_grabage_collect;
    }

    @Override
    protected void initView() {



        if (getIntent()!=null){
            title = getIntent().getStringExtra("title");
            subTitle = getIntent().getStringExtra("subTitle");
        }

        tvTitle.setText(title+"_融融网");

        initWebview();
        dWebView.loadUrl(AppUtils.BASE_URL+"help/"+subTitle);

    }

    private void initWebview() {
        WebSettings setting = dWebView.getSettings();
        setting.setJavaScriptEnabled(true);//支持Js
        setting.setCacheMode(WebSettings.LOAD_DEFAULT);//缓存模式
        //是否支持画面缩放，默认不支持
        setting.setBuiltInZoomControls(true);
        setting.setSupportZoom(true);
        //是否显示缩放图标，默认显示
        setting.setDisplayZoomControls(false);
        //设置网页内容自适应屏幕大小
        setting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);//注意网上例程很多的是.SINGLE_COLUMN，但调试时发现移动版网站会错位，所以改成
        //SINGLE_COLUMN

        setting.setUseWideViewPort(true);
        setting.setLoadWithOverviewMode(true);

    }

    @Override
    protected void addListener() {

    }

    public static Intent queryIntent(Context context, String title, String subTitle) {
        Intent intent = new Intent(context, GrabageCollectActivity.class);
        intent.putExtra("title",title);
        intent.putExtra("subTitle",subTitle);
        return intent;
    }

}
